<!DOCTYPE html>
<html>
<head>
	<title></title>
	<!--[if lt IE 9]>
	<meta http-equiv="refresh" content="0;ie.html" />
	<![endif]-->

	<link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
   <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__STATIC__/layout/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
	<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/channel.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
      <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
	<script src="__STATIC__/layout/js/jquery.min.js"></script>
	<!-- Sweet Alert -->
	<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<!-- Sweet alert -->
	<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
	<!-- layer javascript -->
	<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>

</head>
<body class="white-bg" style="padding: 3px">
<div  >
	<div class="padding-10">
		<a href="javascript:;" class="btn btn-w-m btn-info" id="new">添加新的分区</a>
		<a href="javascript:;" class="btn btn-w-m btn-info" id="new2">添加新的省份</a>
		<a href="javascript:;" class="btn btn-w-m btn-info" id="new3">分区树</a>
	</div>
	<div class="ibox-content">

		<form id="form1" class="form-inline" method="get" action="{:url('index')}">
			<strong>模糊查询:</strong>
			<div class="form-group">
				<label for="search2">分区名称</label>
				<input type="text" name="title" value="{$title}" placeholder="请输入分区名称" id="search2" class="form-control">
			</div>
			<div class="form-group">
				<label for="search2">分区负责人</label>
				<input type="text" name="head" value="{$head}" placeholder="请输入分区负责人" id="search3" class="form-control">
			</div>
			<div class="form-group">
				<label for="search2">分区管理人员</label>
				<input type="text" name="admin" value="{$admin}" placeholder="请输入分区管理人员" id="search4" class="form-control">
			</div><br><br>
			<button class="btn btn-info" type="submit">查询</button>
			<button class="btn btn-info" type="reset" id="reset">清空查询条件</button>
			<div class="ibox-tools">
				<button id="isdel" class="btn btn-info" type="button">回收站</button>
			</div>
		</form>
		<script>
			$(function () {
//			    回收站
                $('#isdel').on('click',function () {
                    var index = layer.open({
                        type: 2,
                        title: '省份-回收站',
//                        area: ['500px', '400px'],
                        fixed: false, //不固定
                        maxmin: true,
                        content: '{:url("isdel")}'
                    });
                    layer.full(index)
                    return false
                })
				$('#reset').on('click',function () {
					document.getElementById('search2').value = ''
					document.getElementById('search3').value = ''
					document.getElementById('search4').value = ''
					$('#form1').submit()
					return false
                })
            })
		</script>
	</div>
	

		<table class="table table-striped table-bordered table-hover bud_hei text-center">
			<thead>
			<tr class="info">
				<th class="text-center">分区名称</th>
				<th class="text-center">分区负责人</th>
				<th class="text-center">分区管理人员</th>
				<th class="text-center">对应省份</th>
				<th class="text-center">操作</th>
			</tr>
			</thead>
			<tbody>
			{volist name="data" id="row"}
			<tr class="gradeX">
				<td>{$row.title}</td>
				<td>{$row.head}</td>
				<td>{$row.admin}</td>
				<td>{$row.provice}</td>
				<td class="center">
					<a href="javascript:;" data-id="{$row.id}"  class="xiugai">修改</a>&nbsp;&nbsp;<a href="javascript:;" data-id="{$row.id}" class="shanchu">删除</a>
				</td>
			</tr>
			{/volist}

			</tbody>

		</table>
	<div class="row text-center" id="pageText" style="padding: 0;margin: 0;">
			<div class="col-sm-6 text-left"><div class="padding-10 countSize">共{$count}条记录，{$maxpage}页&nbsp;&nbsp;</div></div>
			<div class="col-sm-6 text-right">{$page}</div>
		</div>

</div>
</body>
</html>
<script>
    $(function () {
        //新增
        $('#new2').on('click',function () {

            //iframe层-父子操作
            layer.open({
                type: 2,
                title: '新增',
                 area: ['700px', '500px'],
                fixed: false, //不固定
                maxmin: true,
                content: '{:url("zprovice/addview")}'
            });
            return false

        })
        //新增
        $('#new3').on('click',function () {

            //iframe层-父子操作
            layer.open({
                type: 2,
                title: '分区树',
                area: ['700px', '500px'],
                fixed: false, //不固定
                maxmin: true,
                content: '{:url("zonetree")}'
            });
            return false

        })

        //新增
        $('#new').on('click',function () {

            //iframe层-父子操作
            layer.open({
                type: 2,
                title: '新增',
                 area: ['700px', '500px'],
                fixed: false, //不固定
                maxmin: true,
                content: '{:url("addview")}'
            });
            return false

        })

		//修改
		$('.xiugai').on('click',function () {
            var id = $(this).data('id')
            //iframe层-父子操作
            layer.open({
                type: 2,
                title: '修改',
                area: ['700px', '500px'],
                fixed: false, //不固定
                maxmin: true,
                content: '{:url("updateview")}?id='+id
            });
            return false
        })

		//删除
        $('.shanchu').click(function () {
            var id = $(this).data('id')
            swal({
                title: "您确定要删除这条信息吗",
                text: "删除后将会出现在回收站！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "删除",
                closeOnConfirm: false
            }, function () {
                $.ajax({
                    'type':'post',
                    'url':'{:url("delete")}',
                    'data':{'id':id},
                    'dataType':'json',
                    'success':function (data) {
                        if(data.success){
                            location.reload()
                        }else
                            swal(data.msg, "", "error");
                    }
                })

            });
        });

    })
</script>